package com.hm.quartz.task;

import com.hm.common.core.domain.entity.SysUser;
import com.hm.manage.utils.HikArtemisUtiles;
import com.hm.manage.utils.SmsService;
import com.hm.system.service.ISysUserService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Objects;

@Slf4j
@Component("artemisTask")
public class ArtemisTask {

    @Resource
    private HikArtemisUtiles hikArtemisUtiles;

    @Autowired
    private SmsService smsService;

    /***
     * 检测过车数量，发送短信
     */
    public void checkVehicleCount(String deptName) {
        Integer passCount = hikArtemisUtiles.getCurrentVehiclePassCount();
        String con = "正常";
        if (passCount < 4000000) {
            con = "异常，少于均值400万";
        }
        // 发送短信
        String content = new SimpleDateFormat("yyyy-MM-dd").format(new Date())+"公安网过车截止8:30分数量为："+passCount+"过车"+con;
        log.info("---------------content:{}",content);
        smsService.sendtoUserByDeptName(deptName,content);

    }

    public void doPost(){
        log.info("===================="+hikArtemisUtiles.getCurrentVehiclePassCount());
    }
}
